package com.shiwu.service;

import com.shiwu.dao.ShiWuDao;
import com.shiwu.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Lelezhang
 * @create 2020-02-10 13:05
 */
@Service
public class ShiWuService {
    @Autowired
    private ShiWuDao shiWuDao;

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public void test01() {
        User user = new User("1", "1");
        shiWuDao.save(user);
        this.test02();
    }

    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public void test02() {
        int i = 1/0;
        User user = new User("2", "2");
        shiWuDao.save(user);
    }
}
